package com.jiajiankang.myspace;

import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.jiajiankang.R;

public class MybaseinfoActivity extends Activity {
	private ListView listview;
	private SimpleAdapter adapter;
	private List<Map<String, String>> data = null;
	private Button btnback;
	private  Button btnedit;

	/* (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mybaseinfo);
		btnedit=(Button)findViewById(R.id.mybaseinfo_edit);
		btnedit.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MybaseinfoActivity.this, EditMyBaseInfo.class);
				startActivity(intent);
			}
		});
		btnback = (Button) findViewById(R.id.mybaseinfo_back);
		listview = (ListView) findViewById(R.id.mybaseinfo_listview);
		data = Mybaseinfo_myDataSource.getMaps();
		adapter = new SimpleAdapter(MybaseinfoActivity.this, data,
				R.layout.mybaseinfo_list, new String[] { "phonenumber",
						"logintime", "name", "reallyname", "homeaddress",
						"sparecontacts", "sparecontactsnumber" }, new int[] {
						R.id.phonenumber, R.id.logontime, R.id.name,
						R.id.reallyname, R.id.homeaddress, R.id.sparecontacts,
						R.id.sparecontactsnumber });
		listview.setAdapter(adapter);
		listview.setEnabled(false);
		btnback.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MybaseinfoActivity.this, MySpace.class);
				startActivity(intent);
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
